import pandas as pd
df = pd.read_excel('销售统计表.xlsx', sheet_name=None)
with pd.ExcelWriter('销售统计表_数据透视表.xlsx') as workbook:
    for name, data in df.items():
        pivot = data.pivot_table(values='销售金额', index='销售地区', columns='销售分部', aggfunc='sum', fill_value=0)
        pivot.to_excel(workbook, sheet_name=f'{name}透视表', index=True)
